package com.fhzn.auth.web;

import com.fhzn.auth.entity.WebResponse;
import com.fhzn.auth.service.DataResourceService;
import com.fhzn.auth.web.request.DataResourceOpRequest;
import com.fhzn.auth.web.vo.DataResourceVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author 老顾
 * @apiNote 数据资源管理
 * @since 2024/1/19
 */
@RestController
@RequestMapping("data-resource")
@RequiredArgsConstructor
public class DataResourceController {

    private final DataResourceService dataResourceService;

    @PostMapping("/add")
    public WebResponse<DataResourceVO> addDataResource(@RequestBody DataResourceOpRequest request) {
        return WebResponse.success(dataResourceService.add(request));
    }

    @PostMapping("/deleteByCode")
    public WebResponse<String> deleteByCode(@RequestBody DataResourceOpRequest request) {
        return WebResponse.success(dataResourceService.deleteByCode(request));
    }
}
